/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Lenovo
 * Date: 2025-03-18
 * Time: 15:45
 */
public class Student {
    private String name;
    private int age;

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }

    //重写 toString() 方法
    @Override
    public String toString() {
        return name + "," +  age;
    }

    public static void main(String[] args) {
        Student student = new Student("liming", 25);
        System.out.println(student); // 默认调用 toString()
        //输出：liming,25
    }
}